package cn.edu.qzuie.artist.module.td.controller.app.teacher;

import cn.edu.qzuie.artist.framework.common.pojo.CommonResult;

import cn.edu.qzuie.artist.module.td.controller.app.student.vo.AppStudentAuthLoginRepVo;
import cn.edu.qzuie.artist.module.td.controller.app.student.vo.AppStudentAuthLoginRespVo;
import cn.edu.qzuie.artist.module.td.controller.app.teacher.vo.AppTeacherAuthLoginRepVo;
import cn.edu.qzuie.artist.module.td.controller.app.teacher.vo.AppTeacherAuthLoginRespVo;
import cn.edu.qzuie.artist.module.td.service.teacher.TeacherService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;

import static cn.edu.qzuie.artist.framework.common.pojo.CommonResult.success;

/**
 * AppTeacherController
 *
 * @author life.
 * @date 2025/3/31
 */
@Tag(name = "教师APP - TD教师")
@RestController
@RequestMapping("/td/AppTeacher")
@Validated
public class AppTeacherController {
    @Resource
    private TeacherService teacherService;

    @PermitAll
    @PostMapping("/login")
    @Operation(summary = "教师登录")
    public CommonResult<AppTeacherAuthLoginRepVo> login(@Valid @RequestBody AppTeacherAuthLoginRespVo reqVO) {
        AppTeacherAuthLoginRepVo login = teacherService.login(reqVO);
        return success(login);
    }


    @PostMapping("/refresh-token")
    @Operation(summary = "刷新令牌")
    @Parameter(name = "refreshToken", description = "刷新令牌", required = true)
    @PermitAll
    public CommonResult<AppTeacherAuthLoginRepVo> refreshToken(@RequestParam("refreshToken") String refreshToken) {
        return success(teacherService.refreshToken(refreshToken));
    }
    @GetMapping("/test")
    public String text(){
        return "test";
    }


}